import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'AppTheme.dart';

buildNetImage(String url) {
  return CachedNetworkImage(
    fit: BoxFit.cover,
    imageUrl: url,
    placeholder: (BuildContext context, String url) {
      return CupertinoActivityIndicator();
    },
    errorWidget: (context, url, error) {
      return Center(
        child: Icon(
          Icons.error,
          size: 30,
          color: AppTheme.pinkColor,
        ),
      );
    },
  );
}

buildItemImage(String url) {
  return ConstrainedBox(
    constraints: BoxConstraints.expand(),
    child: buildNetImage(url),
  );
}
